home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / WASTE 1.3a1.sit / WASTE 1.3a1 Distribution / WASTE 1.3a1 / WASTEIntf.h < prev    next >
Encoding:
Text File  |  1996-08-23  |  64.7 KB  |  1,488 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    WASTEIntf.h
  3.  *
  4.  *    WASTE PROJECT
  5.  *  Internal (private) interface, version 1.3a1
  6.  *
  7.  *  Copyright (c) 1993-1996 Marco Piovanelli
  8.  *    All Rights Reserved
  9.  *
  10.  *  C port by Dan Crevier
  11.  *
  12.  */
  13.  
  14. //    Toolbox #includes
  15.  
  16. #ifndef __CONDITIONALMACROS__
  17. #include <ConditionalMacros.h>
  18. #endif
  19.  
  20. #ifndef UNIVERSAL_INTERFACES_VERSION
  21. #error "You need Universal Headers version 2.1 or newer to compile WASTE"
  22. #endif
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29. #include <MixedMode.h>
  30. #endif
  31.  
  32. #ifndef __CODEFRAGMENTS__
  33. #include <CodeFragments.h>
  34. #endif
  35.  
  36. #ifndef __ERRORS__
  37. #include <Errors.h>
  38. #endif
  39.  
  40. #ifndef __GESTALT__
  41. #include <Gestalt.h>
  42. #endif
  43.  
  44. #ifndef __MEMORY__
  45. #include <Memory.h>
  46. #endif
  47.  
  48. #ifndef __FONTS__
  49. #include <Fonts.h>
  50. #endif
  51.  
  52. #ifndef __QUICKDRAWTEXT__
  53. #include <QuickdrawText.h>
  54. #endif
  55.  
  56. #ifndef __QUICKDRAW__
  57. #include <Quickdraw.h>
  58. #endif
  59.  
  60. #ifndef __QDOFFSCREEN__
  61. #include <QDOffscreen.h>
  62. #endif
  63.  
  64. #ifndef __PALETTES__
  65. #include <Palettes.h>
  66. #endif
  67.  
  68. #ifndef __TEXTEDIT__
  69. #include <TextEdit.h>
  70. #endif
  71.  
  72. #ifndef __SCRAP__
  73. #include <Scrap.h>
  74. #endif
  75.  
  76. #ifndef __SCRIPT__
  77. #include <Script.h>
  78. #endif
  79.  
  80. #ifndef __TOOLUTILS__
  81. #include <ToolUtils.h>
  82. #endif
  83.  
  84. #ifndef __TEXTUTILS__
  85. #include <TextUtils.h>
  86. #endif
  87.  
  88. #ifndef __LOWMEM__
  89. #include <LowMem.h>
  90. #endif
  91.  
  92. #ifndef __APPLEEVENTS__
  93. #include <AppleEvents.h>
  94. #endif
  95.  
  96. #ifndef __AEREGISTRY__
  97. #include <AERegistry.h>
  98. #endif
  99.  
  100. #ifndef __DRAG__
  101. #include <Drag.h>
  102. #endif
  103.  
  104. #ifndef __TEXTSERVICES__
  105. #include <TextServices.h>
  106. #endif
  107.  
  108. //    ANSI #includes
  109.  
  110. #ifndef _LIMITS
  111. #include <limits.h>
  112. #endif
  113.  
  114. //    other #includes
  115.  
  116. #ifndef __LONGCOORDINATES__
  117. #ifndef _LongCoords_
  118. #include "LongCoords.h"
  119. #endif
  120. #endif
  121.  
  122. // MPW needs topLeft and botRight defined here
  123. #ifndef topLeft
  124. #define topLeft(r)                      (((Point *) &(r))[0])
  125. #endif
  126.  
  127. #ifndef botRight
  128. #define botRight(r)                     (((Point *) &(r))[1])
  129. #endif
  130.  
  131. // pascal-like macros for testing, setting, clearing and inverting bits
  132. #define BTST( FLAGS, BIT )                ((FLAGS) &   (1L << (BIT)))
  133. #define BSET( FLAGS, BIT )              ((FLAGS) |=  (1L << (BIT)))
  134. #define BCLR( FLAGS, BIT )              ((FLAGS) &= ~(1L << (BIT)))
  135. #define BCHG( FLAGS, BIT )              ((FLAGS) ^=  (1L << (BIT)))
  136.  
  137. // pascal-like macros for shifting bits
  138. #define BSL( A, B )                        (((SInt32) (A)) << (B))
  139. #define BSR( A, B )                        (((SInt32) (A)) >> (B))
  140.  
  141. // macros used in conjunction with the styleRunPosition parameter
  142. #define IS_LEFTMOST_RUN(RUN)            ((RUN) <= leftStyleRun)
  143. #define IS_RIGHTMOST_RUN(RUN)            (! ((RUN) & 0x01))
  144.  
  145. // other macros
  146. #define ABS(A)                             ((A) > 0 ? (A) : -(A))
  147. #define BLOCK_CLR(X)                    _WEBlockClr(&(X), sizeof(X));
  148.  
  149. // define WASTE_VERSION is standard NumVersion format
  150.  
  151. #define WASTE_VERSION                    0x01304001    /* 1.3a1 */
  152.  
  153. // set WASTE_DEBUG to 1 to perform various consistency checks;
  154. // errors will be reported with DebugStr()
  155. // WARNING: when WASTE_DEBUG is set, WEIdle() calls can be extremely time-consuming
  156. #ifndef WASTE_DEBUG
  157. #define WASTE_DEBUG                        0
  158. #endif
  159.  
  160. // set WASTE_OBJECTS to 0 if you don't need embedded objects
  161. #ifndef WASTE_OBJECTS
  162. #define    WASTE_OBJECTS                    1
  163. #endif
  164.  
  165. // set WASTE_USE_UPPS to 0 if you don't need UPPs
  166. #ifndef WASTE_USE_UPPS
  167. #define WASTE_USE_UPPS                    GENERATINGCFM
  168. #endif
  169.  
  170. // set WASTE_REDRAW_SPEED to 1 to use Mark Alldritt's optimizations of _WERedraw
  171. #ifndef WASTE_REDRAW_SPEED
  172. #define WASTE_REDRAW_SPEED                0
  173. #endif
  174.  
  175. // set WASTE_NO_SYNCH to 1 if you don't want WASTE to synchronize keyboard and fonts
  176. #ifndef WASTE_NO_SYNCH
  177. #define WASTE_NO_SYNCH                    0
  178. #endif
  179.  
  180. // set WASTE_NO_RO_CARET to 1 to hide the caret in read-only mode
  181. #ifndef WASTE_NO_RO_CARET
  182. #define WASTE_NO_RO_CARET                1
  183. #endif
  184.  
  185. // set WASTE_IC_SUPPORT to 1 to use Dan Crevier's
  186. // support of URL cmd-clicking through Internet Config
  187. #ifndef WASTE_IC_SUPPORT
  188. #define WASTE_IC_SUPPORT                1
  189. #endif
  190.  
  191. // If WASTE_OBJECTS_ARE_GLYPHS is set to 0 (default), WEGetOffset returns kObjectEdge in
  192. // the edge parameter when thePoint is in the middle half of an object: as a result,
  193. // clicking in the middle of an object immediately _selects_ the object, so that a second
  194. // click immediately following triggers the 'clik' callback (this can be handy to make
  195. // sound objects play when they are double-clicked, for example).
  196.  
  197. // If WASTE_OBJECTS_ARE_GLYPHS is set to 1, WEGetOffset treats embedded objects
  198. // like ordinary glyphs and never returns kObjectEdge in the edge parameter:
  199. // as a result, clicking in the middle of an object always positions the caret either
  200. // to the left or to the right of the object.
  201.  
  202. #ifndef WASTE_OBJECTS_ARE_GLYPHS
  203. #define WASTE_OBJECTS_ARE_GLYPHS        0
  204. #endif
  205.  
  206. // set WASTE_RESOLVE_FONT_DESIGNATORS to false if you don't want WASTE to
  207. // map font designators (the special IDs 0 and 1 that identify the system
  208. // and application fonts, respectively) to the actual font IDs.
  209.  
  210. #ifndef WASTE_RESOLVE_FONT_DESIGNATORS
  211. #define WASTE_RESOLVE_FONT_DESIGNATORS    1
  212. #endif
  213.  
  214. // set WASTE_WECALTEXT_DOES_REDRAW to 1 if you want WECalText()
  215. // to automatically redraw all the text (as in WASTE 1.1 final)
  216.  
  217. #ifndef WASTE_WECALTEXT_DOES_REDRAW
  218. #define WASTE_WECALTEXT_DOES_REDRAW        0
  219. #endif
  220.  
  221. // set WASTE_KURTHS_OPTION_ARROWS to 0 to use the old
  222. // implementation of option + left/right arrow combinations, which is
  223. // less conformant to Apple's HIGs than the current implementation,
  224. // due to Stefan Kurth
  225.  
  226. #ifndef WASTE_KURTHS_OPTION_ARROWS
  227. #define WASTE_KURTHS_OPTION_ARROWS        1
  228. #endif
  229.  
  230. // set WASTE_TRANSLUCENT_DRAGS to 1 if you want to be able to
  231. // use translucent dragging for text
  232.  
  233. #ifndef WASTE_TRANSLUCENT_DRAGS
  234. #define WASTE_TRANSLUCENT_DRAGS            0
  235. #endif
  236.  
  237. // macros for debugging
  238.  
  239. #if WASTE_DEBUG
  240. #define WEASSERT(CONDITION, WARNING)    { if (!(CONDITION)) DebugStr(WARNING); }
  241. #else
  242. #define WEASSERT(CONDITION, WARNING)
  243. #endif
  244.  
  245. // determine if inline functions are supported
  246.  
  247. #if defined(__cplusplus) || defined(__MWERKS__)
  248. #define INLINE inline
  249. #else
  250. #define INLINE static
  251. #endif
  252.  
  253. // result codes
  254. enum {
  255.     weCantUndoErr                =    -10015,    // undo buffer is clear (= errAECantUndo)
  256.     weEmptySelectionErr            =    -10013,    // selection range is empty (= errAENoUserSelection)
  257.     weUnknownObjectTypeErr        =    -9478,    // specified object type is not registered
  258.     weObjectNotFoundErr            =    -9477,    // no object found at specified offset
  259.     weReadOnlyErr                =    -9476,    // instance is read-only
  260.     weMonoStyledErr                =    -9475,    // instance is mono-styled
  261.     weNotHandledErr                =    -1708,  // please use default handling (= errAEEventNotHandled)
  262.     weNewerVersionErr            =    -1706,    // need a newer version of WASTE (= errAENewerVersion)
  263.     weCorruptDataErr            =    -1702,    // corrupt data (= errAECorruptData)
  264.     weProtocolErr                =    -603,    // improper call order (= protocolErr)
  265.     weUndefinedSelectorErr        =    -50,    // unknown selector
  266.     weNoDragErr                 =     128        // can be returned internally by _WEDrag
  267. };
  268.  
  269. // values for WEInstallObjectHandler handlerSelector parameter
  270. enum {
  271.     weNewHandler         =     'new ',
  272.     weDisposeHandler     =     'free',
  273.     weDrawHandler         =     'draw',
  274.     weClickHandler         =     'clik',
  275.     weStreamHandler        =    'strm'
  276. };
  277.  
  278. // action kinds
  279. enum {
  280.     weAKNone            =    0,        // null action
  281.     weAKUnspecified        =    1,        // action of unspecified nature
  282.     weAKTyping            =    2,        // some text has been typed in
  283.     weAKCut                =    3,        // the selection range has been cut
  284.     weAKPaste            =    4,        // something has been pasted
  285.     weAKClear            =    5,        // the selection range has been deleted
  286.     weAKDrag            =    6,        // drag and drop operation
  287.     weAKSetStyle        =    7        // some style has been applied to a text range
  288. };
  289.  
  290. // action flags
  291. enum {
  292.     weAFIsRedo            =    0x0001,    // action saves edit state prior to a WEUndo call
  293.     weAFDontSaveText    =    0x0002, // don't save text
  294.     weAFDontSaveStyles    =    0x0004,    // don't save styles
  295.     weAFDontSaveSoup    =    0x0008    // don't save soup
  296. };
  297.  
  298. // destination kinds for streaming objects
  299. enum {
  300.     weToScrap            =    0,
  301.     weToDrag            =    1,
  302.     weToSoup            =    2
  303. };
  304.  
  305. // alignment styles
  306. enum {
  307.     weFlushLeft         =    -2,        // flush left
  308.     weFlushRight        =    -1,        // flush right
  309.     weFlushDefault        =     0,        // flush according to system direction
  310.     weCenter            =     1,        // centered
  311.     weJustify            =     2        // fully justified
  312. };
  313.  
  314. // dominant line directions
  315. enum {
  316.     weDirRightToLeft    =    -1,        // right-to-left
  317.     weDirLeftToRight    =     0,        // left-to-right
  318.     weDirDefault        =     1        // according to system direction
  319. };
  320.  
  321. #define IsRightToLeft(direction)    (((direction) == weDirRightToLeft) || (((direction) == weDirDefault) && (GetSysDirection() != 0)))
  322.  
  323. // values for the edge parameter
  324. enum {
  325.     kLeadingEdge         =     -1,        // point is on the leading edge of a glyph
  326.     kTrailingEdge         =      0,        // point is on the trailing edge of a glyph
  327.     kObjectEdge         =      2        // point is inside an embedded object
  328. };
  329.  
  330. // control character codes
  331. enum {
  332.     kObjectMarker         =    0x01,
  333.     kBackspace             =    0x08,
  334.     kTab                 =    0x09,
  335.     kEOL                 =    0x0D,
  336.     kArrowLeft             =    0x1C,
  337.     kArrowRight         =    0x1D,
  338.     kArrowUp             =    0x1E,
  339.     kArrowDown             =    0x1F,
  340.     kSpace                 =      0x20,
  341.     kForwardDelete         =    0x7F
  342. };
  343.  
  344. // bit equates for the tsFlags field of the WETextStyle record
  345. enum {
  346.     tsTSMHilite         =    4,        // set if style run is part of active input area
  347.     tsTSMSelected         =    5,        // set for selected raw/converted text
  348.     tsTSMConverted         =    6,        // set for converted text, clear for raw text
  349.     tsRightToLeft         =    7        // set for right-to-left runs
  350. };
  351.  
  352. // bit equates for the mode parameter in WESetStyle and WEContinuousStyle
  353. enum {
  354.     kModeFont             =    0,        // change font
  355.     kModeFace             =    1,        // change Quickdraw styles
  356.     kModeSize             =    2,        // change point size
  357.     kModeColor             =    3,        // change color
  358.     kModeAddSize         =    4,        // add tsSize to existing size
  359.     kModeToggleFace     =    5,        // toggle continuous styles rather than setting them
  360.     kModeReplaceFace     =    6,        // tsFace replaces existing styles outright
  361.     kModePreserveScript =    7,        // apply font to runs of same script only
  362.     kModeExtractSubscript = 8,        // apply font to eligible subruns of different script
  363.     kModeFaceMask         =     9,        // change Quickdraw styles; use mask
  364.     kModeObject         =     14,        // change tsObject field
  365.     kModeFlags             =     15        // change tsFlags field
  366. };
  367.  
  368. // values for the mode parameter in WESetStyle and WEContinuousStyle
  369. enum {
  370.     weDoFont                =    1 << kModeFont,
  371.     weDoFace                =    1 << kModeFace,
  372.     weDoSize                =    1 << kModeSize,
  373.     weDoColor                =    1 << kModeColor,
  374.     weDoAll                    =    weDoFont + weDoFace + weDoSize + weDoColor,
  375.     weDoAddSize                =    1 << kModeAddSize,
  376.     weDoToggleFace            =    1 << kModeToggleFace,
  377.     weDoReplaceFace            =    1 << kModeReplaceFace,
  378.     weDoPreserveScript        =    1 << kModePreserveScript,
  379.     weDoSmartFont            =    weDoFont + weDoPreserveScript,
  380.     weDoExtractSubscript    =    1 << kModeExtractSubscript,
  381.     weDoFaceMask            =    1 << kModeFaceMask,
  382.     weDoObject                =    1 << kModeObject,
  383.     weDoFlags                =    1 << kModeFlags
  384. };
  385.  
  386. // values for WEFeatureFlag action parameter
  387. enum {
  388.     weBitSet             =     1,        // enables the specified feature
  389.     weBitClear             =     0,        // disables the specified feature
  390.     weBitTest             =    -1,        // returns the current setting of the specified feature
  391.     weBitToggle         =    -2        // toggles the specified feature
  392. };
  393.  
  394. // bit equates for the flags field in the WE record
  395. enum {
  396.     weFHasColorQD             =    31,        // Color Quickdraw is available
  397.     weFHasDragManager         =    30,        // the Drag Manager is available
  398.     weFHasTextServices        =    29,        // the Text Services Manager is available
  399.     weFNonRoman                =    28,        // at least one non-Roman script is enabled
  400.     weFDoubleByte            =    27,        // a double-byte script is enabled
  401.     weFBidirectional        =    26,        // a bidirectional script is enabled
  402.     weFCaretRight            =    25,        // set if caret was drawn for R-L keyboard script
  403.     weFCaretVisible            =    24,        // the caret is currently visible
  404.     weFMouseTracking        =    23,        // set internally during mouse tracking
  405.     weFAnchorIsEnd            =    22,        // anchor offset is selEnd
  406.     weFUseNullStyle            =    21,        // a null style is associated with the empty selection
  407.     weFActive                =    20,        // we're active
  408.     weFHilited                =    19,        // true if text pane is highlighted (for Drag & Drop)
  409.     weFCanAcceptDrag        =    18,        // the drag in the text pane can be accepted
  410.     weFDragCaretVisible        =    17,        // drag caret is currently visible
  411.     weFDestRectChanged        =    16,        // set if scroll callback needs to be called
  412.     weFHasTranslucentDrags    =    15,        // SetDragImage is available
  413.     weFAccumulateUndos        =    14        // don't clear undo stack before new change
  414. };
  415.  
  416. // bit equates for the features field in the WE record
  417. enum {
  418.     weFInhibitColor        =    31,        // draw in black & white only; ignore color
  419.     weFMonoStyled        =    13,        // disallow style changes
  420.     weFInhibitRedraw    =    12,        // don't redraw text
  421.     weFDrawOffscreen    =    11,        // draw text offscreen for smoother visual results
  422.     weFUseTempMem        =    10,        // use temporary memory for main data structures
  423.     weFInhibitRecal        =     9,        // don't recalculate line breaks and don't redraw text
  424.     weFDragAndDrop        =     8,        // support drag and drop
  425.     weFIntCutAndPaste    =     7,        // intelligent cut & paste
  426.     weFUndoSupport        =     6,        // support undo/redo
  427.     weFReadOnly            =     5,        // disallow editing
  428.     weFOutlineHilite    =     2,        // frame selection range when text pane is inactive
  429.     weFAutoScroll        =     0        // automatically scroll text when cursor is outside pane
  430. };
  431.  
  432. // scrap types
  433. enum {
  434.     kTypeText            =    'TEXT',
  435.     kTypeStyles         =    'styl',
  436.     kTypeSoup             =    'SOUP'
  437. };
  438.  
  439. // selectors for WEGetInfo/WESetInfo
  440. enum {
  441.     weCharByteHook            =    'cbyt',
  442.     weCharTypeHook            =    'ctyp',
  443.     weCharToPixelHook        =    'c2p ',
  444.     weClickLoop                =    'clik',
  445.     weCurrentDrag            =    'drag',
  446.     weDrawTextHook            =    'draw',
  447.     weEraseHook                =    'eras',
  448.     weHiliteDropAreaHook    =    'hidr',
  449.     weLineArray                =    'line',
  450.     weLineBreakHook            =    'lbrk',
  451.     wePixelToCharHook        =    'p2c ',
  452.     wePort                    =    'port',
  453.     weRefCon                =    'refc',
  454.     weRunArray                =    'runa',
  455.     weScrollProc            =    'scrl',
  456.     weStyleTable            =    'styl',
  457.     weText                    =    'text',
  458.     weTranslateDragHook        =    'xdrg',
  459.     weTranslucencyThreshold    =    'tluc',
  460.     weTSMDocumentID            =    'tsmd',
  461.     weTSMPostUpdate            =    'post',
  462.     weTSMPreUpdate            =    'pre ',
  463.     weURLHint                =    'urlh',
  464.     weWordBreakHook            =    'wbrk'
  465. };
  466.  
  467. // possible values returned by WEIntelligentPaste
  468. enum {
  469.     weDontAddSpaces            =     0,
  470.     weAddSpaceOnLeftSide    =    -1,
  471.     weAddSpaceOnRightSide    =     1
  472. };
  473.  
  474. // values for WEAllocate allocFlags parameter
  475. enum {
  476.     kAllocClear            =    0x00000001,    // clear handle after allocation
  477.     kAllocTemp            =    0x00000002    // use temporary memory if available
  478. };
  479.  
  480. // other miscellaneous constants
  481. enum {
  482.     kCaretWidth = 1,            // width of the caret, in pixels
  483.     kMinFontSize = 1,            // minimum valid font size
  484.     kMaxFontSize = SHRT_MAX,    // maximum valid font size
  485.     kInvalidOffset = -1,         // used to flag an invalid or nonexistent offset
  486.     kUnknownObjectType = -1,    // returned by _WELookupObjectType for unknown flavors
  487.     kNullDrag = 0,                // null or nonexistent drag reference
  488.     kTextMargin = 3,            // width of border area surrounding the text (in pixels)
  489.     kMaxScrollDelta = 30,        // maximum scroll amount used by standard click loop
  490.     kAutoScrollDelay = 10,        // delay before auto-scroll starts (in ticks)
  491.     kDefaultObjectHeight = 32,    // default height for new objects
  492.     kDefaultObjectWidth = 32,    // default width for new objects
  493.     kAutoOrderingSize = 32        // size of stack-based format array used by _WESegmentLoop
  494. };
  495.  
  496. #if defined(powerc) || defined (__powerc)
  497. #pragma options align=mac68k
  498. #endif
  499.  
  500. typedef UInt16 WEStyleMode;
  501. typedef SInt8 WEAlignment;
  502. typedef SInt16 WEDirection;
  503. typedef SInt8 WEEdge;
  504. typedef SInt16 WEActionKind;
  505. typedef UInt16 WEActionFlags;
  506.  
  507. // forward declarations
  508.  
  509. typedef struct WERec *WEPtr, **WEHandle;
  510. typedef struct WEObjectDesc *WEObjectDescPtr, **WEObjectDescHandle;
  511.  
  512. typedef struct WETextStyle {
  513.     SInt16 tsFont;                    // font family number
  514.     Style tsFace;                    // set of Quickdraw styles
  515.     UInt8 tsFlags;                    // flags (FOR INTERNAL USE ONLY)
  516.     SInt16 tsSize;                    // font size, in integer points
  517.     RGBColor tsColor;                // absolute red-green-blue color
  518. #if WASTE_OBJECTS
  519.     WEObjectDescHandle tsObject;    // embedded object reference
  520. #endif
  521. } WETextStyle, *WETextStylePtr, **WETextStyleHandle;
  522.  
  523. typedef struct WERunAttributes {
  524.     SInt16 runHeight;            // style run height (ascent + descent + leading)
  525.     SInt16 runAscent;            // font ascent
  526.     WETextStyle runStyle;        // text style
  527. } WERunAttributes, *WERunAttributesPtr, **WERunAttributesHandle;
  528.  
  529. typedef struct WERunInfo {
  530.     SInt32 runStart;            // byte offset to first character of this style run
  531.     SInt32 runEnd;                // byte offset to first character of next style run
  532.     WERunAttributes runAttrs;    // run attributes
  533. } WERunInfo, *WERunInfoPtr, **WERunInfoHandle;
  534.  
  535. typedef struct QDEnvironment {
  536.     GrafPtr envPort;
  537.     PenState envPen;
  538.     WETextStyle envStyle;
  539.     SInt16 envMode;
  540. } QDEnvironment;
  541.  
  542. typedef struct RunArrayElement {
  543.     SInt32 runStart;            // offset to first character in style run
  544.     SInt32 styleIndex;            // index into style table
  545. } RunArrayElement, *RunArrayElementPtr, **RunArrayElementHandle;
  546.  
  547. typedef RunArrayElementPtr RunArrayPtr;
  548. typedef RunArrayElementHandle RunArrayHandle;
  549.  
  550. typedef struct TERunAttributes {
  551.     SInt16 runHeight;
  552.     SInt16 runAscent;
  553.     TextStyle runTEStyle;
  554. } TERunAttributes, *TERunAttributesPtr;
  555.  
  556. typedef struct TEStyleScrapElement {
  557.     SInt32 scrpStartChar;
  558.     TERunAttributes scrpTEAttrs;
  559. } TEStyleScrapElement, *TEStyleScrapElementPtr;
  560.  
  561. typedef struct TEStyleScrap {
  562.     SInt16 scrpNStyles;
  563.     TEStyleScrapElement scrpStyleTab[ kVariableLengthArray ];
  564. } TEStyleScrap, *TEStyleScrapPtr, **TEStyleScrapHandle;
  565.  
  566. typedef struct StyleTableElement {
  567.     SInt32 refCount;            // reference count
  568.     WERunAttributes info;        // style information
  569. } StyleTableElement, *StyleTableElementPtr, **StyleTableElementHandle;
  570.  
  571. typedef StyleTableElementPtr StyleTablePtr;
  572. typedef StyleTableElementHandle StyleTableHandle;
  573.  
  574. typedef struct LineRec {
  575.     SInt32 lineStart;            // byte offset to first character in line
  576.     SInt32 lineOrigin;            // pixel offset from destRect.top
  577.     SInt16 lineAscent;            // maximum font ascent for this line
  578.     SInt16 lineSlop;            // extra pixels needed to fill up the line
  579.     Fixed lineJustAmount;        // normalized slop value, used for justification
  580. } LineRec, *LinePtr, **LineHandle;
  581.  
  582. typedef LinePtr LineArrayPtr;
  583. typedef LineHandle LineArrayHandle;
  584.  
  585. typedef struct WEAction {
  586.     WEHandle hOwner;            // handle to associated WE instance
  587.     struct WEAction **hNext;    // used to keep a linked list of actions
  588.     Handle hText;                // handle to saved text
  589.     Handle hStyles;                // handle to saved styles
  590.     Handle hSoup;                // handle to saved soup
  591.     SInt32 delRangeStart;        // start of range to delete
  592.     SInt32 delRangeLength;        // length of range to delete
  593.     SInt32 insRangeLength;        // lenfth of range to insert
  594.     SInt32 hiliteStart;            // start of range to hilite
  595.     SInt32 hiliteEnd;            // end of range to hilite
  596.     WEActionKind actionKind;    // identifies event that caused this action to be pushed
  597.     WEActionFlags actionFlags;    // miscellaneous flags
  598. } WEAction, *WEActionPtr, **WEActionHandle;
  599.  
  600. // A WESoup record is a static description of an object embedded in the text.
  601. // The 'SOUP' data type is just a collection of WESoup records, each followed
  602. // by the corresponding object data.
  603. // This data type complements the standard TEXT/styl pair.
  604.  
  605. typedef struct WESoup {
  606.     SInt32 soupOffset;            // insertion offset for this object
  607.     FlavorType soupType;        // 4-letter tag identifying object type
  608.     SInt32 soupReserved1;        // reserved for future use; set to zero
  609.     Size soupDataSize;            // size of object data following this record
  610.     Point soupSize;                // object height and width, in pixels
  611.     SInt32 soupReserved2;        // reserved for future use; set to zero
  612. } WESoup, *WESoupPtr, **WESoupHandle;
  613.  
  614. // callback prototypes
  615.  
  616. typedef pascal Boolean (*WEClickLoopProcPtr)(WEHandle hWE);
  617. typedef pascal void (*WEScrollProcPtr)(WEHandle hWE);
  618. typedef pascal void (*WETSMPreUpdateProcPtr)(WEHandle hWE);
  619. typedef pascal void (*WETSMPostUpdateProcPtr)(WEHandle hWE,
  620.         SInt32 fixLength, SInt32 inputAreaStart, SInt32 inputAreaEnd,
  621.         SInt32 pinRangeStart, SInt32 pinRangeEnd);
  622. typedef pascal OSErr (*WETranslateDragProcPtr)(DragReference drag,
  623.         ItemReference dragItem, FlavorType requestedType, Handle putDataHere,
  624.         SInt32 dropOffset, WEHandle hWE);
  625. typedef pascal OSErr (*WEHiliteDropAreaProcPtr)(DragReference drag,
  626.         Boolean hiliteFlag, WEHandle hWE);
  627. typedef pascal OSErr (*WEFontIDToNameProcPtr)(SInt16 fontID, Str255 fontName);
  628. typedef pascal OSErr (*WEFontNameToIDProcPtr)(ConstStr255Param fontName, SInt16 oldFontID, SInt16 *newFontID);
  629. typedef pascal void (*WEDrawTextProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  630.         JustStyleCode styleRunPosition, WEHandle hWE);
  631. typedef pascal SInt32 (*WEPixelToCharProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  632.         Fixed *pixelWidth, WEEdge *edge, JustStyleCode styleRunPosition, Fixed hPos, WEHandle hWE);
  633. typedef pascal SInt16 (*WECharToPixelProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  634.         SInt32 offset, SInt16 direction, JustStyleCode styleRunPosition, SInt16 hPos, WEHandle hWE);
  635. typedef pascal StyledLineBreakCode (*WELineBreakProcPtr)(Ptr pText, SInt32 textLength,
  636.         SInt32 textStart, SInt32 textEnd, Fixed *textWidth, SInt32 *textOffset, WEHandle hWE);
  637. typedef pascal void (*WEWordBreakProcPtr)(Ptr pText, SInt16 textLength, SInt16 offset,
  638.         WEEdge edge, OffsetTable breakOffsets, ScriptCode script, WEHandle hWE);
  639. typedef pascal SInt16 (*WECharByteProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script,
  640.         WEHandle hWE);
  641. typedef pascal SInt16 (*WECharTypeProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script, WEHandle hWE);
  642. typedef pascal void (*WEEraseProcPtr)(const Rect *area, WEHandle hWE);
  643. typedef pascal OSErr (*WENewObjectProcPtr)(Point *defaultObjectSize,
  644.         WEObjectDescHandle hObjectDesc);
  645. typedef pascal OSErr (*WEDisposeObjectProcPtr)(WEObjectDescHandle hObjectDesc);
  646. typedef pascal OSErr (*WEDrawObjectProcPtr)(const Rect *destRect,
  647.         WEObjectDescHandle hObjectDesc);
  648. typedef pascal Boolean (*WEClickObjectProcPtr)(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  649.         WEObjectDescHandle hObjectDesc);
  650. typedef pascal OSErr (*WEStreamObjectProcPtr)(SInt16 destKind, FlavorType *theType, Handle putDataHere, WEObjectDescHandle hObjectDesc);
  651.  
  652.  
  653. // UPP proc info
  654.  
  655. enum {
  656.     uppWEClickLoopProcInfo = kPascalStackBased
  657.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  658.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  659. };
  660. enum {
  661.     uppWEScrollProcInfo = kPascalStackBased
  662.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  663. };
  664. enum {
  665.     uppWETSMPreUpdateProcInfo = kPascalStackBased
  666.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  667. };
  668. enum {
  669.     uppWETSMPostUpdateProcInfo = kPascalStackBased
  670.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  671.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*fixLength*/)))
  672.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*inputAreaStart*/)))
  673.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*inputAreaEnd*/)))
  674.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*pinRangeStart*/)))
  675.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 /*pinRangeEnd*/)))
  676. };
  677. enum {
  678.     uppWETranslateDragProcInfo = kPascalStackBased
  679.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  680.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*drag*/)))
  681.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ItemReference /*dragItem*/)))
  682.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(FlavorType /*requestedType*/)))
  683.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  684.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*dropOffset*/)))
  685.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  686. };
  687. enum {
  688.     uppWEHiliteDropAreaProcInfo = kPascalStackBased
  689.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  690.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*drag*/)))
  691.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(Boolean /*hiliteFlag*/)))
  692.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  693. };
  694. enum {
  695.     uppWEFontIDToNameProcInfo = kPascalStackBased
  696.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  697.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt16 /*fontID*/)))
  698.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(StringPtr /*fontName*/)))
  699. };
  700. enum {
  701.     uppWEFontNameToIDProcInfo = kPascalStackBased
  702.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  703.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(ConstStr255Param /*fontName*/)))
  704.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*oldFontID*/)))
  705.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 * /*newFontID*/)))
  706. };
  707. enum {
  708.     uppWEDrawTextProcInfo = kPascalStackBased
  709.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  710.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  711.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  712.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  713.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  714. };
  715. enum {
  716.     uppWEPixelToCharProcInfo = kPascalStackBased
  717.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt32)))
  718.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  719.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  720.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  721.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Fixed * /*pixelWidth*/)))
  722.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEEdge * /*edge*/)))
  723.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  724.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(Fixed /*hPos*/)))
  725.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  726. };
  727. enum {
  728.     uppWECharToPixelProcInfo = kPascalStackBased
  729.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  730.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  731.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  732.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  733.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  734.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt16 /*direction*/)))
  735.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  736.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(SInt16 /*hPos*/)))
  737.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  738. };
  739. enum {
  740.     uppWELineBreakProcInfo = kPascalStackBased
  741.         | RESULT_SIZE(SIZE_CODE(sizeof(StyledLineBreakCode )))
  742.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  743.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  744.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*textStart*/)))
  745.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*textEnd*/)))
  746.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(Fixed * /*textWidth*/)))
  747.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 * /*textOffset*/)))
  748.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  749. };
  750. enum {
  751.     uppWEWordBreakProcInfo = kPascalStackBased
  752.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  753.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textLength*/)))
  754.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 /*offset*/)))
  755.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEEdge /*edge*/)))
  756.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(OffsetTable * /*breakOffsets*/)))
  757.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  758.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  759. };
  760. enum {
  761.     uppWECharByteProcInfo = kPascalStackBased
  762.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  763.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  764.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  765.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  766.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  767. };
  768. enum {
  769.     uppWECharTypeProcInfo = kPascalStackBased
  770.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  771.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  772.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  773.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  774.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  775. };
  776. enum {
  777.     uppWEEraseProcInfo = kPascalStackBased
  778.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*area*/)))
  779.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  780. };
  781. enum {
  782.     uppWENewObjectProcInfo = kPascalStackBased
  783.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  784.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point * /*defaultObjectSize*/)))
  785.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  786. };
  787. enum {
  788.     uppWEDisposeObjectProcInfo = kPascalStackBased
  789.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  790.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  791. };
  792. enum {
  793.     uppWEDrawObjectProcInfo = kPascalStackBased
  794.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  795.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*destRect*/)))
  796.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  797. };
  798. enum {
  799.     uppWEClickObjectProcInfo = kPascalStackBased
  800.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  801.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point /*hitPt*/)))
  802.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*modifiers*/)))
  803.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(UInt32 /*clickTime*/)))
  804.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  805. };
  806. enum {
  807.     uppWEStreamObjectProcInfo = kPascalStackBased
  808.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  809.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SInt16 /*destKind*/)))
  810.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FlavorType * /*theType*/)))
  811.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  812.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  813. };
  814.  
  815.  
  816. /*    UPPs, NewナProc macros & CallナProc macros */
  817.  
  818. /*
  819.     NOTE:
  820.     For compatibility with the Pascal version, CallナProc macros take the form:
  821.  
  822.         CallFooProc(..., userRoutine)
  823.  
  824.     instead of:
  825.  
  826.         CallFooProc(userRoutine, ...)
  827.  
  828. */
  829.  
  830. #if WASTE_USE_UPPS
  831.  
  832. typedef UniversalProcPtr WEClickLoopUPP;
  833. typedef UniversalProcPtr WEScrollUPP;
  834. typedef UniversalProcPtr WETSMPreUpdateUPP;
  835. typedef UniversalProcPtr WETSMPostUpdateUPP;
  836. typedef UniversalProcPtr WETranslateDragUPP;
  837. typedef UniversalProcPtr WEHiliteDropAreaUPP;
  838. typedef UniversalProcPtr WEFontIDToNameUPP;
  839. typedef UniversalProcPtr WEFontNameToIDUPP;
  840. typedef UniversalProcPtr WEDrawTextUPP;
  841. typedef UniversalProcPtr WEPixelToCharUPP;
  842. typedef UniversalProcPtr WECharToPixelUPP;
  843. typedef UniversalProcPtr WELineBreakUPP;
  844. typedef UniversalProcPtr WEWordBreakUPP;
  845. typedef UniversalProcPtr WECharByteUPP;
  846. typedef UniversalProcPtr WECharTypeUPP;
  847. typedef UniversalProcPtr WEEraseUPP;
  848. typedef UniversalProcPtr WENewObjectUPP;
  849. typedef UniversalProcPtr WEDisposeObjectUPP;
  850. typedef UniversalProcPtr WEDrawObjectUPP;
  851. typedef UniversalProcPtr WEClickObjectUPP;
  852. typedef UniversalProcPtr WEStreamObjectUPP;
  853.  
  854. #define NewWEClickLoopProc(userRoutine) ¥
  855.     (WEClickLoopUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickLoopProcInfo, GetCurrentArchitecture())
  856. #define NewWEScrollProc(userRoutine) ¥
  857.     (WEScrollUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEScrollProcInfo, GetCurrentArchitecture())
  858. #define NewWETSMPreUpdateProc(userRoutine) ¥
  859.     (WETSMPreUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPreUpdateProcInfo, GetCurrentArchitecture())
  860. #define NewWETSMPostUpdateProc(userRoutine) ¥
  861.     (WETSMPostUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPostUpdateProcInfo, GetCurrentArchitecture())
  862. #define NewWETranslateDragProc(userRoutine) ¥
  863.     (WETranslateDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETranslateDragProcInfo, GetCurrentArchitecture())
  864. #define NewWEHiliteDropAreaProc(userRoutine) ¥
  865.     (WEHiliteDropAreaUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEHiliteDropAreaProcInfo, GetCurrentArchitecture())
  866. #define NewWEFontIDToNameProc(userRoutine) ¥
  867.     (WEFontIDToNameUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontIDToNameProcInfo, GetCurrentArchitecture())
  868. #define NewWEFontNameToIDProc(userRoutine) ¥
  869.     (WEFontNameToIDUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontNameToIDProcInfo, GetCurrentArchitecture())
  870. #define NewWEDrawTextProc(userRoutine) ¥
  871.     (WEDrawTextUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawTextProcInfo, GetCurrentArchitecture())
  872. #define NewWEPixelToCharProc(userRoutine) ¥
  873.     (WEPixelToCharUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPixelToCharProcInfo, GetCurrentArchitecture())
  874. #define NewWECharToPixelProc(userRoutine) ¥
  875.     (WECharToPixelUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharToPixelProcInfo, GetCurrentArchitecture())
  876. #define NewWELineBreakProc(userRoutine) ¥
  877.     (WELineBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWELineBreakProcInfo, GetCurrentArchitecture())
  878. #define NewWEWordBreakProc(userRoutine) ¥
  879.     (WEWordBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEWordBreakProcInfo, GetCurrentArchitecture())
  880. #define NewWECharByteProc(userRoutine) ¥
  881.     (WECharByteUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharByteProcInfo, GetCurrentArchitecture())
  882. #define NewWECharTypeProc(userRoutine) ¥
  883.     (WECharTypeUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharTypeProcInfo, GetCurrentArchitecture())
  884. #define NewWEEraseProc(userRoutine) ¥
  885.     (WEEraseUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEEraseProcInfo, GetCurrentArchitecture())
  886. #define NewWENewObjectProc(userRoutine) ¥
  887.     (WENewObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWENewObjectProcInfo, GetCurrentArchitecture())
  888. #define NewWEDisposeObjectProc(userRoutine) ¥
  889.     (WEDisposeObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDisposeObjectProcInfo, GetCurrentArchitecture())
  890. #define NewWEDrawObjectProc(userRoutine) ¥
  891.     (WEDrawObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawObjectProcInfo, GetCurrentArchitecture())
  892. #define NewWEClickObjectProc(userRoutine) ¥
  893.     (WEClickObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickObjectProcInfo, GetCurrentArchitecture())
  894. #define NewWEStreamObjectProc(userRoutine) ¥
  895.     (WEStreamObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEStreamObjectProcInfo, GetCurrentArchitecture())
  896.  
  897. #define CallWEClickLoopProc(hWE, userRoutine) ¥
  898.     CallUniversalProc((userRoutine), uppWEClickLoopProcInfo, (hWE))
  899. #define CallWEScrollProc(hWE, userRoutine) ¥
  900.     CallUniversalProc((userRoutine), uppWEScrollProcInfo, (hWE))
  901. #define CallWETSMPreUpdateProc(hWE, userRoutine) ¥
  902.     CallUniversalProc((userRoutine), uppWETSMPreUpdateProcInfo, (hWE))
  903. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) ¥
  904.     CallUniversalProc((userRoutine), uppWETSMPostUpdateProcInfo, (hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  905. #define CallWETranslateDragProc(drag, dragItem, requestedType, putDataHere, dropOffset, hWE, userRoutine) ¥
  906.     CallUniversalProc((userRoutine), uppWETranslateDragProcInfo, (drag), (dragItem), (requestedType), (putDataHere), (dropOffset), (hWE))
  907. #define CallWEHiliteDropAreaProc(drag, hiliteFlag, hWE, userRoutine) ¥
  908.     CallUniversalProc((userRoutine), uppWEHiliteDropAreaProcInfo, (drag), (hiliteFlag), (hWE))
  909. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) ¥
  910.     CallUniversalProc((userRoutine), uppWEFontIDToNameProcInfo, (fontID), (fontName))
  911. #define CallWEFontNameToIDProc(fontName, oldFontID, fontID, userRoutine) ¥
  912.     CallUniversalProc((userRoutine), uppWEFontNameToIDProcInfo, (fontName), (oldFontID), (fontID))
  913. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) ¥
  914.     CallUniversalProc((userRoutine), uppWEDrawTextProcInfo, (pText), (textLength), (slop), (styleRunPosition), (hWE))
  915. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) ¥
  916.     CallUniversalProc((userRoutine), uppWEPixelToCharProcInfo, (pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  917. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) ¥
  918.     CallUniversalProc((userRoutine), uppWECharToPixelProcInfo, (pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  919. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) ¥
  920.     CallUniversalProc((userRoutine), uppWELineBreakProcInfo, (pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  921. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) ¥
  922.     CallUniversalProc((userRoutine), uppWEWordBreakProcInfo, (pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  923. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) ¥
  924.     CallUniversalProc((userRoutine), uppWECharByteProcInfo, (pText), (textOffset), (script), (hWE))
  925. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) ¥
  926.     CallUniversalProc((userRoutine), uppWECharTypeProcInfo, (pText), (textOffset), (script), (hWE))
  927. #define CallWEEraseProc(area, hWE, userRoutine) ¥
  928.     CallUniversalProc((userRoutine), uppWEEraseProcInfo, (area), (hWE))
  929. #define CallWENewObjectProc(defaultObjectSize, hObjectDesc, userRoutine) ¥
  930.     CallUniversalProc((userRoutine), uppWENewObjectProcInfo, (defaultObjectSize), (hObjectDesc))
  931. #define CallWEDisposeObjectProc(hObjectDesc, userRoutine) ¥
  932.     CallUniversalProc((userRoutine), uppWEDisposeObjectProcInfo, (hObjectDesc))
  933. #define CallWEDrawObjectProc(destRect, hObjectDesc, userRoutine) ¥
  934.     CallUniversalProc((userRoutine), uppWEDrawObjectProcInfo, (destRect), (hObjectDesc))
  935. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, hObjectDesc, userRoutine) ¥
  936.     CallUniversalProc((userRoutine), uppWEClickObjectProcInfo, (hitPt), (modifiers), (clickTime), (hObjectDesc))
  937. #define CallWEStreamObjectProc(destKind, theType, putDataHere, hObjectDesc, userRoutine) ¥
  938.     CallUniversalProc((userRoutine), uppWEStreamObjectProcInfo, (destKind), (theType), (putDataHere), (hObjectDesc))
  939.  
  940. #else
  941.  
  942. typedef WEClickLoopProcPtr WEClickLoopUPP;
  943. typedef WEScrollProcPtr WEScrollUPP;
  944. typedef WETSMPreUpdateProcPtr WETSMPreUpdateUPP;
  945. typedef WETSMPostUpdateProcPtr WETSMPostUpdateUPP;
  946. typedef WETranslateDragProcPtr WETranslateDragUPP;
  947. typedef WEHiliteDropAreaProcPtr WEHiliteDropAreaUPP;
  948. typedef WEFontIDToNameProcPtr WEFontIDToNameUPP;
  949. typedef WEFontNameToIDProcPtr WEFontNameToIDUPP;
  950. typedef WEDrawTextProcPtr WEDrawTextUPP;
  951. typedef WEPixelToCharProcPtr WEPixelToCharUPP;
  952. typedef WECharToPixelProcPtr WECharToPixelUPP;
  953. typedef WELineBreakProcPtr WELineBreakUPP;
  954. typedef WEWordBreakProcPtr WEWordBreakUPP;
  955. typedef WECharByteProcPtr WECharByteUPP;
  956. typedef WECharTypeProcPtr WECharTypeUPP;
  957. typedef WEEraseProcPtr WEEraseUPP;
  958. typedef WENewObjectProcPtr WENewObjectUPP;
  959. typedef WEDisposeObjectProcPtr WEDisposeObjectUPP;
  960. typedef WEDrawObjectProcPtr WEDrawObjectUPP;
  961. typedef WEClickObjectProcPtr WEClickObjectUPP;
  962. typedef WEStreamObjectProcPtr WEStreamObjectUPP;
  963.  
  964. #define NewWEClickLoopProc(userRoutine) ((WEClickLoopUPP) (userRoutine))
  965. #define NewWEScrollProc(userRoutine) ((WEScrollUPP) (userRoutine))
  966. #define NewWETSMPreUpdateProc(userRoutine) ((WETSMPreUpdateUPP) (userRoutine))
  967. #define NewWETSMPostUpdateProc(userRoutine) ((WETSMPostUpdateUPP) (userRoutine))
  968. #define NewWETranslateDragProc(userRoutine) ((WETranslateDragUPP) (userRoutine))
  969. #define NewWEHiliteDropAreaProc(userRoutine) ((WEHiliteDropAreaUPP) (userRoutine))
  970. #define NewWEFontIDToNameProc(userRoutine) ((WEFontIDToNameUPP) (userRoutine))
  971. #define NewWEFontNameToIDProc(userRoutine) ((WEFontNameToIDUPP) (userRoutine))
  972. #define NewWEDrawTextProc(userRoutine) ((WEDrawTextUPP) (userRoutine))
  973. #define NewWEPixelToCharProc(userRoutine) ((WEPixelToCharUPP) (userRoutine))
  974. #define NewWECharToPixelProc(userRoutine) ((WECharToPixelUPP) (userRoutine))
  975. #define NewWELineBreakProc(userRoutine) ((WELineBreakUPP) (userRoutine))
  976. #define NewWEWordBreakProc(userRoutine) ((WEWordBreakUPP) (userRoutine))
  977. #define NewWECharByteProc(userRoutine) ((WECharByteUPP) (userRoutine))
  978. #define NewWECharTypeProc(userRoutine) ((WECharTypeUPP) (userRoutine))
  979. #define NewWEEraseProc(userRoutine) ((WEEraseUPP) (userRoutine))
  980. #define NewWENewObjectProc(userRoutine) ((WENewObjectUPP) (userRoutine))
  981. #define NewWEDisposeObjectProc(userRoutine) ((WEDisposeObjectUPP) (userRoutine))
  982. #define NewWEDrawObjectProc(userRoutine) ((WEDrawObjectUPP) (userRoutine))
  983. #define NewWEClickObjectProc(userRoutine) ((WEClickObjectUPP) (userRoutine))
  984. #define NewWEStreamObjectProc(userRoutine) ((WEStreamObjectUPP) (userRoutine))
  985.  
  986. #define CallWEClickLoopProc(hWE, userRoutine) ¥
  987.     (*(userRoutine))((hWE))
  988. #define CallWEScrollProc(hWE, userRoutine) ¥
  989.     (*(userRoutine))((hWE))
  990. #define CallWETSMPreUpdateProc(hWE, userRoutine) ¥
  991.     (*(userRoutine))((hWE))
  992. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) ¥
  993.     (*(userRoutine))((hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  994. #define CallWETranslateDragProc(drag, dragItem, requestedType, putDataHere, dropOffset, hWE, userRoutine) ¥
  995.     (*(userRoutine))((drag), (dragItem), (requestedType), (putDataHere), (dropOffset), (hWE))
  996. #define CallWEHiliteDropAreaProc(drag, hiliteFlag, hWE, userRoutine) ¥
  997.     (*(userRoutine))((drag), (hiliteFlag), (hWE))
  998. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) ¥
  999.     (*(userRoutine))((fontID), (fontName))
  1000. #define CallWEFontNameToIDProc(fontName, oldFontID, fontID, userRoutine) ¥
  1001.     (*(userRoutine))((fontName), (oldFontID), (fontID))
  1002. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) ¥
  1003.     (*(userRoutine))((pText), (textLength), (slop), (styleRunPosition), (hWE))
  1004. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) ¥
  1005.     (*(userRoutine))((pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  1006. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) ¥
  1007.     (*(userRoutine))((pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  1008. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) ¥
  1009.     (*(userRoutine))((pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  1010. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) ¥
  1011.     (*(userRoutine))((pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  1012. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) ¥
  1013.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  1014. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) ¥
  1015.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  1016. #define CallWEEraseProc(area, hWE, userRoutine) ¥
  1017.     (*(userRoutine))((area), (hWE))
  1018. #define CallWENewObjectProc(defaultObjectSize, hObjectDesc, userRoutine) ¥
  1019.     (*(userRoutine))((defaultObjectSize), (hObjectDesc))
  1020. #define CallWEDisposeObjectProc(hObjectDesc, userRoutine) ¥
  1021.     (*(userRoutine))((hObjectDesc))
  1022. #define CallWEDrawObjectProc(destRect, hObjectDesc, userRoutine) ¥
  1023.     (*(userRoutine))((destRect), (hObjectDesc))
  1024. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, hObjectDesc, userRoutine) ¥
  1025.     (*(userRoutine))((hitPt), (modifiers), (clickTime), (hObjectDesc))
  1026. #define CallWEStreamObjectProc(destKind, theType, putDataHere, hObjectDesc, userRoutine) ¥
  1027.     (*(userRoutine))((destKind), (theType), (putDataHere), (hObjectDesc))
  1028.  
  1029. #endif
  1030.  
  1031. typedef Boolean (*SegmentLoopProcPtr)
  1032.                 (LinePtr pLine,
  1033.                  const WERunAttributes *pAttrs,
  1034.                  Ptr pSegment,
  1035.                  SInt32 segmentStart,
  1036.                  SInt32 segmentLength,
  1037.                  JustStyleCode styleRunPosition,
  1038.                  WEHandle hWE,
  1039.                  void *callbackData);
  1040.  
  1041. typedef FourCharCode WESelector;
  1042.  
  1043. typedef struct WEFieldDescriptor {
  1044.     SInt16 fOffset;
  1045.     SInt16 fLength;
  1046. } WEFieldDescriptor;
  1047.  
  1048. typedef struct WELookupTable {
  1049.     WESelector selector;
  1050.     WEFieldDescriptor desc;
  1051. } WELookupTable;
  1052.  
  1053. typedef struct WEUserInfoEntry {
  1054.     WESelector tag;
  1055.     SInt32 info;
  1056. } WEUserInfoEntry;
  1057.  
  1058. typedef struct WEOHTableElement {
  1059.     FlavorType objectType;
  1060.     WENewObjectUPP newHandler;
  1061.     WEDisposeObjectUPP freeHandler;
  1062.     WEDrawObjectUPP drawHandler;
  1063.     WEClickObjectUPP clickHandler;
  1064.     WEStreamObjectUPP streamHandler;
  1065.     SInt32 refCon;
  1066. } WEOHTableElement, *WEOHTablePtr, **WEOHTableHandle;
  1067.  
  1068. typedef struct WEObjectDesc {
  1069.     FlavorType objectType;                // 4-letter tag identifying object type
  1070.     Handle objectDataHandle;            // handle to object data
  1071.     Point objectSize;                    // object height and width, in pixels
  1072.     WEOHTableHandle objectTable;        // handle to object handler table
  1073.     SInt32 objectIndex;                    // index into object handler table
  1074.     WEHandle objectOwner;                // handle to owner WE instance
  1075.     SInt32 objectRefCon;                // free for use by object handlers
  1076. } WEObjectDesc;
  1077.  
  1078. typedef struct    WERec {
  1079.     GrafPtr port;                            // graphics port text is drawn into
  1080.     Handle hText;                            // handle to the text
  1081.     LineArrayHandle hLines;                    // handle to the line array
  1082.     StyleTableHandle hStyles;                // handle to the style table
  1083.     RunArrayHandle hRuns;                    // handle to the style run array
  1084.     SInt32 textLength;                        // length of text
  1085.     SInt32 nLines;                            // number of lines
  1086.     SInt32 nStyles;                            // number of unique styles in the style table
  1087.     SInt32 nRuns;                            // number of style runs
  1088.     LongRect viewRect;                        // view rectangle, all drawing is clipped to this
  1089.     LongRect destRect;                        // destination rectangle
  1090.     SInt32 selStart;                        // start of selection range
  1091.     SInt32 selEnd;                            // end of selection range
  1092.     UInt32 flags;                            // 32 bits of miscellaneous flags (private)
  1093.     UInt32 features;                        // 32 bit of feature flags (public)
  1094.     UInt32 caretTime;                        // time of most recent caret drawing, in ticks
  1095.     UInt32 clickTime;                        // time of most recent click, in ticks
  1096.     SInt32 clickLoc;                        // byte offset of most recent click
  1097.     SInt32 anchorStart;                        // start offset of anchor word/line
  1098.     SInt32 anchorEnd;                        // end offset of anchor word/line
  1099.     char firstByte;                            // first byte of a double-byte character
  1100.     WEEdge clickEdge;                        // edge of character hit by most recent click
  1101.     UInt8 clickCount;                        // multiple click count
  1102.     WEAlignment alignment;                    // alignment style
  1103.     WEDirection direction;                    // dominant line direction
  1104.     SInt16 filler1;                            // unused
  1105.     GrafPtr offscreenPort;                    // offscreen graphics world
  1106.     RgnHandle viewRgn;                        // handle to the view region
  1107.     void *refCon;                            // reference value for client use
  1108.     Handle hUserInfo;                        // more junk for client use
  1109.     TSMDocumentID tsmReference;                // reference value for the text services manager
  1110.     SInt32 tsmAreaStart;                    // start of active input area (for TSM)
  1111.     SInt32 tsmAreaEnd;                        // end of active input area
  1112.     DragReference currentDrag;                // reference of drag being tracked by _WEDrag
  1113.     SInt32 dragCaretOffset;                    // offset to caret displayed during a drag
  1114.     WEActionHandle hActionStack;            // action stack for undo
  1115.     UInt32 modCount;                        // modification count
  1116.     WEClickLoopUPP clickLoop;                // click loop callback
  1117.     WEScrollUPP scrollProc;                    // scroll callback
  1118.     WETSMPreUpdateUPP tsmPreUpdate;            // TSM pre-update callback
  1119.     WETSMPostUpdateUPP tsmPostUpdate;        // TSM post-update callback
  1120.     WETranslateDragUPP translateDragHook;    // drag translation hook
  1121.     WEHiliteDropAreaUPP hiliteDropAreaHook;    // drop area highlighting hook
  1122.     WEDrawTextUPP drawTextHook;                // hook for drawing text
  1123.     WEPixelToCharUPP pixelToCharHook;        // hook for hit-testing
  1124.     WECharToPixelUPP charToPixelHook;        // hook for locating glyph position
  1125.     WELineBreakUPP lineBreakHook;            // hook for finding line breaks
  1126.     WEWordBreakUPP wordBreakHook;            // hook for finding word breaks
  1127.     WECharByteUPP charByteHook;                // hook for finding character byte type
  1128.     WECharTypeUPP charTypeHook;                // hook for finding character type
  1129.     WEEraseUPP eraseHook;                    // hook for erasing background
  1130.     WERunAttributes nullStyle;                // style for null selection
  1131.     WEOHTableHandle hObjectHandlerTable;    // handle to object handler table for this instance
  1132.     SInt32 translucencyThreshold;            // use translucent drags unless selection area exceeds this
  1133.     StringHandle hURLHint;                    // hint string for slack URLs
  1134. } WERec;
  1135.  
  1136. struct SLDrawData {
  1137.     GrafPtr screenPort;
  1138.     GDHandle screenDevice;
  1139.     PixMapHandle offscreenPixels;    // offscreen pixel map
  1140.     Rect bounds;                    // bounds of offscreen buffer, in global coords
  1141.     Rect lineRect;                    // rect enclosing current line
  1142.     Rect drawRect;                    // visible portion of line rect
  1143.     Boolean usingColor;                // true if drawing in color
  1144.     Boolean usingOffscreen;            // true if an offscreen graphics world has been set up
  1145.     Boolean drawingOffscreen;        // true if actually drawing to an offscreen buffer
  1146.     Boolean doErase;                // true if line rectangle should be erased before drawing
  1147. };
  1148.  
  1149. struct SLCalcSlopData {
  1150.     SInt16 lineWidth;
  1151.     SInt16 totalSlop;
  1152.     Fixed totalProportion;
  1153. };
  1154.  
  1155. struct SLPixelToCharData {
  1156.     Fixed hPos;
  1157.     Fixed pixelWidth;
  1158.     SInt32 offset;
  1159.     WEEdge edge;
  1160. };
  1161.  
  1162. struct SLCharToPixelData {
  1163.     LongPt *thePoint;
  1164.     SInt32 offset;
  1165.     SInt16 direction;
  1166.     Boolean lineDir;    // is the line direction RL?
  1167.     Boolean rightEdge;    // are we getting the right edge of the line?
  1168. };
  1169.  
  1170. struct SLCollectHiliteRgnData {
  1171.     SInt32 rangeStart;
  1172.     SInt32 rangeEnd;
  1173.     SInt16 hPos;
  1174. };
  1175.  
  1176. struct SLCrossDirectionBoundaryData {
  1177.     SInt32 oldOffset;        //    offset before crossing direction boundary
  1178.     SInt32 newOffset;        //    offset after crossing direction boundary
  1179.     Boolean movingRight;    //    moving insertion point to the right?
  1180.     Boolean isDone;
  1181. };
  1182.  
  1183. struct FormatOrderData {
  1184.     SInt32 firstRun;
  1185.     WEHandle hWE;
  1186. };
  1187.  
  1188.  
  1189. #if defined(powerc) || defined (__powerc)
  1190. #pragma options align=reset
  1191. #endif
  1192.  
  1193. #ifdef __cplusplus
  1194. extern "C" {
  1195. #endif
  1196.  
  1197. // Routines in WEAccessors.c
  1198. pascal SInt32 WEOffsetToLine(SInt32 offset, WEHandle hWE);
  1199. pascal SInt32 WECountLines(WEHandle hWE);
  1200. pascal void WEGetLineRange(SInt32 lineIndex, SInt32 *lineStart, SInt32 *lineEnd, WEHandle hWE);
  1201. pascal SInt32 WEOffsetToRun (SInt32 offset, WEHandle hWE);
  1202. pascal SInt32 WECountRuns(WEHandle hWE);
  1203. pascal void WEGetRunRange(SInt32 runIndex, SInt32 *runStart, SInt32 *runEnd, WEHandle hWE);
  1204. pascal SInt32 _WEPixelToLine(SInt32 vOffset, WEHandle hWE);
  1205. pascal void _WEGetIndStyle(SInt32 runIndex, WERunInfo *info, WEHandle hWE);
  1206. pascal Boolean _WEGetIndDirection(SInt32 runIndex, WEHandle hWE);
  1207. pascal Boolean WEGetRunDirection(SInt32 offset, WEHandle hWE);
  1208. pascal void WEGetRunInfo(SInt32 offset, WERunInfo *info, WEHandle hWE);
  1209. pascal void WESetDestRect(const LongRect *destRect, WEHandle hWE);
  1210. pascal void WEGetDestRect(LongRect *destRect, WEHandle hWE);
  1211. pascal void WESetViewRect(const LongRect *viewRect, WEHandle hWE);
  1212. pascal void WEGetViewRect(LongRect *viewRect, WEHandle hWE);
  1213. pascal WEAlignment WEGetAlignment(WEHandle hWE);
  1214. pascal WEDirection WEGetDirection(WEHandle hWE);
  1215. pascal void WEGetSelection(SInt32 *selStart, SInt32 *selEnd, WEHandle hWE);
  1216. pascal SInt32 WEGetTextLength(WEHandle hWE);
  1217. pascal SInt32 WEGetHeight(SInt32 startLine, SInt32 endLine, WEHandle hWE);
  1218. pascal Handle WEGetText(WEHandle hWE);
  1219. pascal SInt16 WEGetChar(SInt32 offset, WEHandle hWE);
  1220. pascal SInt16 WEFeatureFlag(SInt16 feature, SInt16 action, WEHandle hWE);
  1221. pascal UInt32 WEVersion(void);
  1222.  
  1223. // WEBirthDeath.c
  1224. extern const Point kOneToOneScaling;
  1225. pascal OSErr _WERegisterWithTSM(WEHandle hWE);
  1226. pascal void _WESetStandardHooks(WEHandle hWE);
  1227. pascal OSErr WENew(const LongRect *destRect, const LongRect *viewRect, UInt32 features, WEHandle *hWE);
  1228. pascal void _WEResetStyleTable(WEHandle hWE);
  1229. pascal void WEDispose(WEHandle hWE);
  1230. pascal OSErr WEUseText(Handle text, WEHandle hWE);
  1231. pascal void _WEStdDrawText(Ptr pText, SInt32 textLength, Fixed slop,
  1232.                 JustStyleCode styleRunPosition, WEHandle hWE);
  1233. pascal SInt32 _WEStdPixelToChar(Ptr pText, SInt32 textLength, Fixed slop,
  1234.                 Fixed *width, WEEdge *edge, JustStyleCode styleRunPosition,
  1235.                 Fixed hPos, WEHandle hWE);
  1236. pascal SInt16 _WEStdCharToPixel(Ptr pText, SInt32 textLength, Fixed slop,
  1237.                 SInt32 offset, SInt16 direction, JustStyleCode styleRunPosition,
  1238.                 SInt16 hPos, WEHandle hWE);
  1239. pascal StyledLineBreakCode _WEStdLineBreak(Ptr pText, SInt32 textLength,
  1240.                 SInt32 textStart, SInt32 textEnd, Fixed *textWidth,
  1241.                 SInt32 *textOffset, WEHandle hWE);
  1242. pascal void _WEStdWordBreak(Ptr pText, SInt16 textLength, SInt16 offset,
  1243.                 WEEdge edge, OffsetTable breakOffsets, ScriptCode script,
  1244.                 WEHandle hWE);
  1245. pascal SInt16 _WEStdCharByte(Ptr pText, SInt16 textLength, ScriptCode script,
  1246.                 WEHandle hWE);
  1247. pascal SInt16 _WEStdCharType(Ptr pText, SInt16 textLength, ScriptCode script,
  1248.                 WEHandle hWE);
  1249. pascal SInt16 _WEScriptToFont(ScriptCode script);
  1250. pascal void _WEOldWordBreak(Ptr pText, SInt16 textLength, SInt16 offset,
  1251.                 WEEdge edge, OffsetTable breakOffsets, ScriptCode script,
  1252.                 WEHandle hWE);
  1253. pascal SInt16 _WEOldCharByte(Ptr pText, SInt16 textLength, ScriptCode script,
  1254.                 WEHandle hWE);
  1255. pascal SInt16 _WEOldCharType(Ptr pText, SInt16 textLength, ScriptCode script,
  1256.                 WEHandle hWE);
  1257. pascal Boolean _WEStdClickLoop(WEHandle hWE);
  1258. pascal OSErr _WEStdHiliteDropArea(DragReference drag, Boolean hiliteFlag, WEHandle hWE);
  1259. pascal void _WEStdErase(const Rect *area, WEHandle hWE);
  1260.  
  1261. // WEDebug.c
  1262. pascal void _WESanityCheck(WEHandle hWE);
  1263.  
  1264. // WEDrawing.c
  1265. pascal OSErr WEGetSelectedObject(WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1266. pascal SInt32 WEFindNextObject(SInt32 offset, WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1267. pascal void _WEContinuousStyleRange(SInt32 rangeStart, SInt32 rangeEnd,
  1268.         WEStyleMode *mode, WETextStyle *ts, WEHandle hWE);
  1269. pascal void _WESynchNullStyle(WEHandle hWE);
  1270. pascal Boolean WEContinuousStyle(WEStyleMode *mode, TextStyle *ts, WEHandle hWE);
  1271. pascal void _WESegmentLoop(SInt32 firstLine, SInt32 lastLine, SegmentLoopProcPtr callback, void *callbackData, WEHandle hWE);
  1272. pascal void _WEDrawTSMHilite(Rect *segmentRect, UInt8 tsFlags);
  1273. pascal void _WEDrawLines (SInt32 firstLine, SInt32 lastLine, Boolean doErase, WEHandle hWE);
  1274. pascal SInt16 _WECalcPenIndent(const LineRec * pLine, WEAlignment alignment, WEDirection direction);
  1275. pascal void _WESaveQDEnvironment(GrafPtr port, Boolean saveColor, QDEnvironment *environment);
  1276. pascal void _WERestoreQDEnvironment(const QDEnvironment *environment);
  1277. pascal void _WEFillFontInfo (GrafPtr port, WERunAttributes *targetStyle);
  1278. pascal void _WECopyStyle (const WETextStyle *sourceStyle, WETextStyle *targetStyle,
  1279.         Style offStyles, WEStyleMode mode);
  1280. pascal Boolean _WEOffsetInRange(SInt32 offset, WEEdge edge, SInt32 rangeStart, SInt32 rangeEnd);
  1281.  
  1282. // WEFontTables.c
  1283. pascal OSErr WEBuildFontTable(Handle hFontTable, WEFontIDToNameUPP fontIDToNameProc, WEHandle hWE);
  1284. pascal OSErr WEUpdateFontTable(Handle hFontTable, WEFontNameToIDUPP fontNameToIDProc, Boolean *wasChanged);
  1285. pascal OSErr WEUpdateStyleScrap(StScrpHandle hStyles, Handle hFontTable);
  1286.  
  1287. // WEHighLevelEditing.c
  1288. pascal void _WEPushAction(WEActionHandle hAction);
  1289. pascal OSErr _WENewAction(SInt32 rangeStart, SInt32 rangeEnd, SInt32 newTextLength,
  1290.                             WEActionKind actionKind, WEActionFlags actionFlags,
  1291.                             WEHandle hWE, WEActionHandle *hAction);
  1292. pascal void _WEDisposeAction(WEActionHandle hAction);
  1293. pascal void _WEForgetAction(WEActionHandle *hAction);
  1294. pascal OSErr _WEDoAction(WEActionHandle hAction);
  1295. pascal OSErr WEUndo(WEHandle hWE);
  1296. pascal void WEClearUndo(WEHandle hWE);
  1297. pascal WEActionKind WEGetUndoInfo(Boolean *redoFlag, WEHandle hWE);
  1298. pascal OSErr WEBeginAction(WEHandle hWE);
  1299. pascal OSErr WEEndAction(WEActionKind actionKind, WEHandle hWE);
  1300. pascal UInt32 WEGetModCount(WEHandle hWE);
  1301. pascal void WEResetModCount(WEHandle hWE);
  1302. pascal void _WEAdjustUndoRange(SInt32 moreBytes, WEHandle hWE);
  1303. pascal OSErr _WETypeChar(char theByte, WEHandle hWE);
  1304. pascal OSErr _WEBackspace(WEHandle hWE);
  1305. pascal OSErr _WEForwardDelete(WEHandle hWE);
  1306. pascal Boolean WEIsTyping(WEHandle hWE);
  1307. pascal void WEKey(SInt16 key, EventModifiers modifiers, WEHandle hWE);
  1308. pascal OSErr WEInsert(Ptr textPtr, SInt32 textLength, StScrpHandle hStyles, Handle hSoup, WEHandle hWE);
  1309. pascal OSErr WEInsertObject(FlavorType objectType, Handle objectDataHandle, Point objectSize, WEHandle hWE);
  1310. pascal OSErr WEDelete(WEHandle hWE);
  1311. pascal OSErr WECut(WEHandle hWE);
  1312. pascal Boolean WECanPaste(WEHandle hWE);
  1313. pascal OSErr WEPaste(WEHandle hWE);
  1314. pascal OSErr _WESmartSetFont(WEStyleMode mode, const TextStyle *ts, WEHandle hWE);
  1315. pascal OSErr WESetStyle(WEStyleMode mode, const TextStyle *ts, WEHandle hWE);
  1316. pascal OSErr WEUseStyleScrap(StScrpHandle hStyles, WEHandle hWE);
  1317. pascal OSErr WEUseSoup(Handle hSoup, WEHandle hWE);
  1318.  
  1319. // WEInlineInput.c
  1320. pascal OSErr _WEHiliteRangeArray(TextRangeArrayHandle hTray, WEHandle hWE);
  1321. pascal OSErr _WEHandleUpdateActiveInputArea(const AppleEvent *ae, AppleEvent *reply, SInt32 handlerRefCon);
  1322. pascal OSErr _WEHandlePositionToOffset(const AppleEvent *ae, AppleEvent *reply, SInt32 handlerRefCon);
  1323. pascal OSErr _WEHandleOffsetToPosition(const AppleEvent *ae, AppleEvent *reply, SInt32 handlerRefCon);
  1324. pascal OSErr WEInstallTSMHandlers(void);
  1325. pascal OSErr WERemoveTSMHandlers(void);
  1326. pascal void WEStopInlineSession(WEHandle hWE);
  1327.  
  1328. // WELineLayout.c
  1329. pascal void _WERemoveLine(SInt32 lineIndex, WEPtr pWE);
  1330. pascal OSErr _WEInsertLine(SInt32 lineIndex, const LineRec *pLine, WEPtr pWE);
  1331. pascal void _WEBumpOrigin(SInt32 lineIndex, SInt32 deltaOrigin, WEPtr pWE);
  1332. pascal SInt32 _WEFindLineBreak(SInt32 lineStart, WEHandle hWE);
  1333. pascal void _WECalcHeights(SInt32 rangeStart, SInt32 rangeEnd, SInt16 *lineAscent, SInt16 *lineDescent,
  1334.         WEHandle hWE);
  1335. pascal OSErr _WERecalBreaks(SInt32 *startLine, SInt32 *endLine, WEHandle hWE);
  1336. pascal void _WERecalSlops(SInt32 firstLine, SInt32 lastLine, WEHandle hWE);
  1337. pascal OSErr WECalText(WEHandle hWE);
  1338. pascal void WESetAlignment(WEAlignment alignment, WEHandle hWE);
  1339. pascal void WESetDirection(WEDirection direction, WEHandle hWE);
  1340.  
  1341. // WELowLevelEditing.c
  1342. pascal Boolean _WEIsWordRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1343. pascal Boolean _WEIsPunct(SInt32 offset, WEHandle hWE);
  1344. pascal void _WEIntelligentCut(SInt32 *rangeStart, SInt32 *rangeEnd, WEHandle hWE);
  1345. pascal SInt16 _WEIntelligentPaste(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1346. pascal OSErr _WEInsertRun(SInt32 runIndex, SInt32 offset, SInt32 styleIndex, WEPtr pWE);
  1347. pascal void _WERemoveRun(SInt32 runIndex, WEPtr pWE);
  1348. pascal void _WEChangeRun(SInt32 runIndex, SInt32 newStyleIndex, Boolean keepOld, WEPtr pWE);
  1349. pascal OSErr _WENewStyle(const WETextStyle *ts, SInt32 *styleIndex, WEPtr pWE);
  1350. pascal OSErr _WERedraw(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1351. pascal OSErr _WESetStyleRange(SInt32 rangeStart, SInt32 rangeEnd, WEStyleMode mode,
  1352.                 const WETextStyle *ts, WEHandle hWE);
  1353. pascal OSErr _WEApplyStyleScrap(SInt32 rangeStart, SInt32 rangeEnd, StScrpHandle styleScrap, WEHandle hWE);
  1354. pascal OSErr _WEApplySoup(SInt32 offset, Handle hSoup, WEHandle hWE);
  1355. pascal void _WEBumpRunStart(SInt32 runIndex, SInt32 deltaRunStart, WEPtr pWE);
  1356. pascal void _WERemoveRunRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1357. pascal void _WEBumpLineStart(SInt32 lineIndex, SInt32 deltaLineStart, WEPtr pWE);
  1358. pascal void _WERemoveLineRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1359. pascal OSErr _WEDeleteRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1360. pascal OSErr _WEInsertText(SInt32 offset, Ptr textPtr, SInt32 textLength, WEHandle hWE);
  1361.  
  1362. // WELongCoords.c
  1363. pascal SInt32 _WEPinInRange(SInt32 value, SInt32 rangeStart, SInt32 rangeEnd);
  1364. pascal void WELongPointToPoint(const LongPt *lp, Point *p);
  1365. pascal void WEPointToLongPoint(Point p, LongPt *lp);
  1366. pascal void WESetLongRect(LongRect *lr, SInt32 left, SInt32 top, SInt32 right, SInt32 bottom);
  1367. pascal void WELongRectToRect(const LongRect *lr, Rect *r);
  1368. pascal void WERectToLongRect(const Rect *r, LongRect *lr);
  1369. pascal void WEOffsetLongRect(LongRect *lr, SInt32 hOffset, SInt32 vOffset);
  1370. pascal Boolean WELongPointInLongRect(const LongPt *lp, const LongRect *lr);
  1371.  
  1372. // WEMouse.c
  1373. pascal Boolean _WEIsOptionDrag(DragReference drag);
  1374. pascal OSErr _WEGetFlavor(DragReference drag, ItemReference dragItem,
  1375.                 FlavorType requestedType, Handle hFlavor,
  1376.                 SInt32 dropOffset, WEHandle hWE);
  1377. pascal OSErr _WEExtractFlavor(DragReference drag, ItemReference dragItem,
  1378.                         FlavorType theType, Handle *hFlavor,
  1379.                         SInt32 dropOffset, WEHandle hWE);
  1380. pascal Boolean WECanAcceptDrag(DragReference drag, WEHandle hWE);
  1381. pascal void _WEUpdateDragCaret(SInt32 offset, WEHandle hWE);
  1382. pascal OSErr WETrackDrag(DragTrackingMessage message, DragReference drag,
  1383.                                     WEHandle hWE);
  1384. pascal OSErr WEReceiveDrag(DragReference drag, WEHandle hWE);
  1385. pascal OSErr _WESendFlavor(FlavorType requestedType, void *dragSendRefCon,
  1386.                                     WEHandle hWE, DragReference drag);
  1387. pascal Boolean WEDraggedToTrash(DragReference drag);
  1388. pascal RgnHandle _WEOutlineRgn(RgnHandle solidRgn);
  1389. pascal OSErr _WEMakeDragImage(GWorldPtr *imageGWorld, RgnHandle *imageRgn, WEHandle hWE);
  1390. pascal OSErr _WEDrag(Point mouseLoc, EventModifiers modifiers, UInt32 clickTime, WEHandle hWE);
  1391. pascal void _WEResolveURL(EventModifiers modifiers, SInt32 urlStart, SInt32 urlEnd, WEHandle hWE);
  1392. pascal void WEClick(Point mouseLoc, EventModifiers modifiers, UInt32 clickTime, WEHandle hWE);
  1393. pascal UInt16 WEGetClickCount(WEHandle hWE);
  1394.  
  1395. // WEObjects.c
  1396. pascal FlavorType WEGetObjectType(WEObjectDescHandle hObjectDesc);
  1397. pascal Handle WEGetObjectDataHandle(WEObjectDescHandle hObjectDesc);
  1398. pascal Point WEGetObjectSize(WEObjectDescHandle hObjectDesc);
  1399. pascal WEHandle WEGetObjectOwner(WEObjectDescHandle hObjectDesc);
  1400. pascal SInt32 WEGetObjectRefCon(WEObjectDescHandle hObjectDesc);
  1401. pascal void WESetObjectRefCon(WEObjectDescHandle hObjectDesc, SInt32 refCon);
  1402. pascal SInt32 _WELookupObjectType(FlavorType objectType, WEOHTableHandle hTable);
  1403. pascal OSErr _WEGetIndObjectType(SInt32 index, FlavorType *objectType, WEHandle hWE);
  1404. pascal OSErr _WENewObject(FlavorType objectType, Handle objectDataHandle, WEHandle hWE,
  1405.                     WEObjectDescHandle *hObjectDesc);
  1406. pascal OSErr _WEFreeObject(WEObjectDescHandle hObjectDesc);
  1407. pascal OSErr _WEDrawObject(WEObjectDescHandle hObjectDesc);
  1408. pascal Boolean _WEClickObject(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  1409.                                 WEObjectDescHandle hObjectDesc);
  1410. pascal OSErr _WEStreamObject(SInt16 destKind, FlavorType *theType, Handle *theData,
  1411.                 Boolean *canDisposeData, WEObjectDescHandle hObjectDesc);
  1412. pascal OSErr WEInstallObjectHandler(FlavorType objectType, WESelector handlerSelector,
  1413.                 UniversalProcPtr handler, WEHandle hWE);
  1414. pascal OSErr WEGetObjectHandler(FlavorType objectType, WESelector handlerSelector,
  1415.                 UniversalProcPtr *handler, WEHandle hWE);
  1416.  
  1417. // WEScraps.c
  1418. pascal OSErr _WEPrependStyle(Handle hStyleScrap, const WERunInfo *info, SInt32 offsetDelta);
  1419. pascal OSErr _WEAppendStyle(Handle hStyleScrap, const WERunInfo *info, SInt32 offset);
  1420. pascal OSErr _WEPrependObject(Handle hSoup, const WERunInfo *info, SInt32 offsetDelta);
  1421. pascal OSErr _WEAppendObject(Handle hSoup, const WERunInfo *info, SInt32 offset);
  1422. pascal OSErr WECopyRange(SInt32 rangeStart, SInt32 rangeEnd, Handle hText, Handle
  1423.                     hStyles, Handle hSoup, WEHandle hWE);
  1424. pascal OSErr WECopy(WEHandle hWE);
  1425.  
  1426. // WESelecting.c
  1427. pascal void _WEClearHiliteBit(void);
  1428. pascal SInt32 WEGetOffset(const LongPt *thePoint, WEEdge *edge, WEHandle hWE);
  1429. pascal void WEGetPoint(SInt32 offset, SInt16 direction, LongPt *thePoint, SInt16 *lineHeight, WEHandle hWE);
  1430. pascal void WEFindLine(SInt32 offset, WEEdge edge, SInt32 *lineStart, SInt32 *lineEnd, WEHandle hWE);
  1431. pascal void WEFindParagraph(SInt32 offset, WEEdge edge, SInt32 *parStart, SInt32 *parEnd, WEHandle hWE);
  1432. pascal SInt16 _WEGetContext(SInt32 offset, SInt32 *contextStart, SInt32 *contextEnd,
  1433.                         WEHandle hWE);
  1434. pascal SInt16 _WEGetRestrictedContext(SInt32 offset, SInt32 *contextStart, SInt32 *contextEnd,
  1435.                         WEHandle hWE);
  1436. pascal void WEFindWord(SInt32 offset, WEEdge edge, SInt32 *wordStart, SInt32 *wordEnd, WEHandle hWE);
  1437. pascal SInt16 WECharByte(SInt32 offset, WEHandle hWE);
  1438. pascal SInt16 WECharType(SInt32 offset, WEHandle hWE);
  1439. pascal void _WEGetCaretRect(SInt32 offset, SInt16 direction, Rect *caretRect, WEHandle hWE);
  1440. pascal void _WEDrawCaret(SInt32 offset, SInt16 direction, Boolean useDualCaret, WEHandle hWE);
  1441. pascal void _WEBlinkCaret(WEHandle hWE);
  1442. pascal RgnHandle WEGetHiliteRgn(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1443. pascal void _WEHiliteRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1444. pascal void WESetSelection(SInt32 selStart, SInt32 selEnd, WEHandle hWE);
  1445. pascal SInt32 _WECrossDirectionBoundary(SInt32 offset, Boolean movingRight, WEHandle hWE);
  1446. pascal SInt32 _WEArrowOffset(SInt16 action, SInt32 offset, WEHandle hWE);
  1447. pascal void _WEDoArrowKey (SInt16 arrow, EventModifiers modifiers, WEHandle hWE);
  1448. pascal Boolean WEAdjustCursor(Point mouseLoc, RgnHandle mouseRgn, WEHandle hWE);
  1449. pascal void WEIdle(UInt32 *maxSleep, WEHandle hWE);
  1450. pascal void WEUpdate(RgnHandle updateRgn, WEHandle hWE);
  1451. pascal void WEDeactivate(WEHandle hWE);
  1452. pascal void WEActivate(WEHandle hWE);
  1453. pascal Boolean WEIsActive(WEHandle hWE);
  1454. pascal void WEScroll(SInt32 hOffset, SInt32 vOffset, WEHandle hWE);
  1455. pascal void WEPinScroll(SInt32 hOffset, SInt32 vOffset, WEHandle hWE);
  1456. pascal Boolean _WEScrollIntoView (SInt32 offset, WEHandle hWE);
  1457. pascal void WESelView(WEHandle hWE);
  1458.  
  1459. // WESharedLibrary.c
  1460. pascal OSErr _WECFMInitialize(const CFragInitBlock *theInitBlock);
  1461. pascal void _WECFMTerminate(void);
  1462.  
  1463. // WESelectors.c
  1464. extern WELookupTable _weMainSelectorTable[];
  1465. extern WELookupTable _weObjectHandlerSelectorTable[];
  1466. pascal void _WELookupSelector(const WELookupTable *table, WESelector selector, WEFieldDescriptor *desc);
  1467. pascal OSErr _WEGetField(const WELookupTable *table, WESelector selector, SInt32 *info, void *structure);
  1468. pascal OSErr _WESetField(const WELookupTable *table, WESelector selector, SInt32 *info, void *structure);
  1469. pascal OSErr WEGetInfo(WESelector selector, void *info, WEHandle hWE);
  1470. pascal OSErr WESetInfo(WESelector selector, const void *info, WEHandle hWE);
  1471.  
  1472. // WEUserSelectors.c
  1473. pascal OSErr WEGetUserInfo(WESelector tag, SInt32 *userInfo, WEHandle hWE);
  1474. pascal OSErr WESetUserInfo(WESelector tag, SInt32 userInfo, WEHandle hWE);
  1475.  
  1476. // WEUtilities.c
  1477. pascal void _WEForgetHandle(Handle *h);
  1478. pascal Boolean _WESetHandleLock(Handle h, Boolean lock);
  1479. pascal void _WEBlockClr(void *block, Size blockSize);
  1480. pascal Boolean _WEBlockCmp(const void *block1, const void *block2, Size blockSize);
  1481. pascal void _WEReorder(SInt32 *a, SInt32 *b);
  1482. pascal OSErr _WEAllocate(Size blockSize, UInt32 allocFlags, Handle *h);
  1483. pascal OSErr _WESplice(Handle h, const void *blockPtr, SInt32 blockSize, SInt32 offset);
  1484.  
  1485. #ifdef __cplusplus
  1486. }
  1487. #endif
  1488.